




lst = [11, 22, 33, 44, 55, 66, 77, 88, 99, 123, 234, 345, 456, 567, 678, 789]

def  binary_search(n,left,right):
    if left <= right :
        middle = (left+right) // 2
        if  n  <lst[middle] :
            right = middle -1
        elif n >lst[middle]:
            left = middle  + 1
        else :
            return middle
        return binary_search(n,left,right)  # 不加return返回永远是None
    else :
        return -1  #没有找到
 
print(binary_search(567,0,len(lst)-1))